//
//  UIBarButtonItem+Extension.m
//  GDWeiboNJ
//
//  Created by zhouguodong on 15/4/5.
//  Copyright (c) 2015年 shuanyuan. All rights reserved.
//

#import "UIBarButtonItem+Extension.h"

@implementation UIBarButtonItem (Extension)
+ (UIBarButtonItem *)itemWithImage:(NSString *)image highImage:(NSString *)highimage target:(id)target action:(SEL)action
{
    UIButton *btn = [[UIButton alloc]init];
    // 设置对应状态图片
    [btn setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:highimage] forState:UIControlStateHighlighted];
    // 设置frame
    btn.size = btn.currentImage.size;
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return [[UIBarButtonItem alloc]initWithCustomView:btn];
}
@end
